Skip to content

Add nearing quota warning #896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 2, 2025
Merged

Add nearing quota warning #896

merged 7 commits into from
Apr 2, 2025

Conversation

girishpanchal30
Copy link
Contributor

@girishpanchal30 girishpanchal30 commented Mar 19, 2025

All Submissions:

Changes proposed in this Pull Request:

Show a warning for exceeding quota soon if the user reaches over 50% of their monthly visit limit within two weeks.

image

Closes https://github.com/Codeinwp/optimole-service/issues/1318

How to test the changes in this Pull Request:

  1. Merge PR #1442 to use the days_since_registration value.
  2. Manually update the visitor's limit.
  3. Go to the plugin dashboard to see the warning.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@girishpanchal30 girishpanchal30 requested a review from abaicus March 19, 2025 13:45
@pirate-bot
Copy link
Collaborator

pirate-bot commented Mar 19, 2025

Plugin build for 5a8291d is ready 🛎️!

@girishpanchal30 girishpanchal30 force-pushed the feat/opml-service/1318 branch from f09d200 to 00c46dc Compare March 20, 2025 09:51
@abaicus
Copy link
Contributor

abaicus commented Mar 24, 2025

@girishpanchal30 looks good 👍🏻

Can you please also fix the merge conflict on this? Thank you!

@girishpanchal30
Copy link
Contributor Author

@abaicus Resolved

@girishpanchal30
Copy link
Contributor Author

@abaicus I applied the following changes to test_preloading_header_image and test_preloading_logo, which seem to have resolved the PHPUnit test case errors.

index 4ad23a7..3375b31 100644
--- a/tests/test-preloading.php
+++ b/tests/test-preloading.php
@@ -52,7 +52,12 @@ class Test_Preloading extends WP_UnitTestCase {
 		set_theme_mod( 'header_image', $header_image_data->url );
 		set_theme_mod( 'header_image_data', $header_image_data );
 
-		$header = get_header_image_tag();
+		$header = get_header_image_tag(
+			array(
+				'fetchpriority' => 'high',
+			)
+		);
+
 		$this->assertStringContainsString( 'fetchpriority="high"', $header );
 
 		// Test it doesn't add the attribute when called again.
@@ -62,11 +67,18 @@ class Test_Preloading extends WP_UnitTestCase {
 
 	public function test_preloading_logo() {
 		set_theme_mod( 'custom_logo', self::$sample_attachement );
+		add_filter( 'get_custom_logo_image_attributes', array( $this, 'custom_logo_image_attributes' ), 999 );
 		$logo = get_custom_logo();
+		remove_filter( 'get_custom_logo_image_attributes', array( $this, 'custom_logo_image_attributes' ), 999 );
 		$this->assertStringContainsString( 'fetchpriority="high"', $logo );
 
 		// Test it doesn't add the attribute when called again.
 		$logo = get_custom_logo();
 		$this->assertStringNotContainsString( 'fetchpriority="high"', $logo );
 	}
+
+	public function custom_logo_image_attributes( $attributes ) {
+		$attributes['fetchpriority'] = 'high';
+		return $attributes;
+	}
 }

Should I include these changes in this PR?

@selul
Copy link
Contributor

selul commented Mar 25, 2025

@girishpanchal30 please rebase to have the tests fixed

@girishpanchal30 girishpanchal30 force-pushed the feat/opml-service/1318 branch from 9f628a2 to 6a790ed Compare March 25, 2025 08:39
@girishpanchal30
Copy link
Contributor Author

@selul Done!

@selul selul merged commit 62a5e26 into development Apr 2, 2025
11 checks passed
@selul selul deleted the feat/opml-service/1318 branch April 2, 2025 12:32
@pirate-bot
Copy link
Collaborator

🎉 This PR is included in version 4.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Indicate that an issue has been resolved and released in a particular version of the product.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants